package com.gotloop.dto;

import java.io.Serializable;

/**
 * Mother class of all DTO Objects, and basic msg transfert object.
 * @author jibhaine
 *
 */
public abstract class AbstractDTO implements Serializable {

	/**
	 * generated serial version UID.
	 */
	private static final long serialVersionUID = -3585811042708105174L;

	/**
	 * Returns the dto name.
	 * @return the dto class name, minimized.
	 */
	protected String getObjectName() {
		String name;
		if (this instanceof CommentDTO) {
			name = "comment";
		} else if (this instanceof LoopDTO) {
			name = "loop";
		} else if (this instanceof UserDTO) {
			name = "user";
		} else if (this instanceof TagDTO) {
			name =  "tag";
		} else if (this instanceof ErrorDTO) {
			name =  "error";
		} else {
			return null;
		}
		return name;
	}
}
